package syt.control;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import syt.dao.TestDAO;

import com.Test;


@RequestMapping("/views/*")
public class ViewsController {

	
	private TestDAO testDAO;
	
	@RequestMapping(value="html", method=RequestMethod.GET)
	public String prepare(Model model) {
		model.addAttribute("foo", "bar");
		model.addAttribute("fruit", "apple");
		Test test = new Test();
		test.setName("sss");
		testDAO.saveTest(test);
		
		
		return "html";
	}
	
	@RequestMapping(value="/viewName", method=RequestMethod.GET)
	public void usingRequestToViewNameTranslator(Model model) {
		model.addAttribute("foo", "bar");
		model.addAttribute("fruit", "apple");
	}

	/**
	 * @param testDAO the testDAO to set
	 */
	public void setTestDAO(TestDAO testDAO) {
		this.testDAO = testDAO;
	}

}
